package durak;

import java.util.ArrayList;

import cards.CardState;
import cards.Deck;

public class DurakTable {
	
	DurakDeck mDeck;
	Deck<DurakCard> mDiscardPile;
	
	ArrayList<DurakCard> mUnresolvedAttackCards = new ArrayList<DurakCard>();
	ArrayList<DurakCard> mResolvedCards = new ArrayList<DurakCard>();
	
	boolean putAttackCard(DurakCard aCard)
	{
			aCard.setState(CardState.FaceUp);
		
			System.out.println("New attack card : " + aCard.toString());
			
			mUnresolvedAttackCards.add(aCard);
			
			return true;
	}
	
	boolean beatCard(DurakCard aAttackCard, DurakCard aDefendCard)
	{
		aDefendCard.setState(CardState.FaceUp);

		System.out.println("card : " + aAttackCard.toString() + " was beaten by " + aDefendCard.toString());
		mUnresolvedAttackCards.remove(aAttackCard);
		
		mResolvedCards.add(aDefendCard);
		mResolvedCards.add(aAttackCard);
		
		return true;
	}
	
	public ArrayList<DurakCard> getCardsInGame()
	{
		ArrayList<DurakCard> allCards = new ArrayList<DurakCard>();
		allCards.addAll(mResolvedCards);
		allCards.addAll(mUnresolvedAttackCards);
		return allCards;
	}
	
	DurakDeck getDeck()
	{
		return mDeck;
	}
	
	public ArrayList<DurakCard> getUnresolvedCards()
	{
		return mUnresolvedAttackCards;
	}

	public void setDeck(DurakDeck aDeck) {
		mDeck = aDeck;
		
	}
	
	
	
	
	
	
	
}
